<template>
	<view class="page hotel-orders" style="padding-bottom: 0;">
		<LoadMore ref="LoadMore" id="LoadMore" :token="true" :diffHeight="0" :initData="initData" @dataRefresh='dataRefresh'>
			<view class="order-list">
				<block v-for="(item, index) in dataList" :key="index">
					<view class="item box-shadow">
						<view class="part1 font13 flex-row-between">
							<view>订单号：{{item.crsNo}}</view>
							<view>{{item.createtime}}</view>
						</view>
						<view class="part2 flex-row-start">
							<view class="image bg-cover" :style="{backgroundImage: 'url(' + imgPath + item.hotel_img + ')'}"></view>
							<view class="info flex-column-between">
								<view class="font14">{{item.hotel_name}}</view>
								<view class="font12 font-969696 flex-row-between">
									<view>{{item.room_name}} x{{item.rm_num}}  {{item.crs_packages_name}}</view>
									<view>{{item.user_name}} 共{{item.day_count}}晚</view>
								</view>
								<view class="font12 font-969696 flex-row-between">
									<view>入：{{item.arr}}</view>
									<view>离：{{item.dep}}</view>
								</view>
							</view>
						</view>
						<view class="part3 flex-row-between">
							<view class="flex-row-start">
								<text class="font12 font-969696">我的评分：</text>
								<uni-rate :size="13" :margin="4" :readonly="true" allow-half :value="item.item_avg" />
								<text class="font-assist font13">{{item.item_avg}}分</text>
							</view>
							<view class="btn" @click="Ondelete(item.id)">删除</view>
						</view>
					</view>
				</block>
			</view>
		</LoadMore>
	</view>
</template>

<script>
	import LoadMore from "@/components/j-loadMore/index.vue";
	export default {
		components: { LoadMore },
		data() {
			return {
				imgPath: this.$Config.http_static, // 图片头
				dataList: [],
				// 传参数据
				initData: {
					url: 'myComment',
					param: {}
				},
			}
		},
		methods: {
			// LoadMore返回列表数据
			dataRefresh(e){
				this.dataList = e
			},
			// 删除
			Ondelete(id) {
				let that = this
				uni.showModal({
					title: '操作提示',
					confirmText: '确认',
					confirmColor: '#03004c',
					cancelText: '取消',
					content: '您确认要删除此评论吗?',
					success: function(res) {
						if (res.confirm) {
							that.$Http({
								url: 'delmyComment',
								token: true,
								data: { id: id },
							}).then(res => {
								if (res.code == 1) {
									that.$refs.LoadMore.oncutRefresh(that.initData)
								}
							});
						}
					}
				});
			}
		}
	}
</script>

<style lang="less">
	@import url("style.less");
</style>
